UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dYwdbEx2Q18K6AN94xSFgrEXgJAZHThsDgTxbwSn/+g=' 
WHERE 
  key_id = '13b193551dd21a69e5c50e4b43a87094ded73563ef357baf042c5b66b9f6d519' 
  AND (
    token = 'dYwdbEx2Q18K6AN94xSFgrEXgJAZHThsDgTxbwSn/+g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018