UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+eL7hwrb/NM+zBUflpiFbaEpivUdwcAiHovvS13Oxv8=' 
WHERE 
  key_id = '37c251db063476a69380a34e2a252c8624eaf6e60076fe5725516ee1d3be6b9e' 
  AND (
    token = '+eL7hwrb/NM+zBUflpiFbaEpivUdwcAiHovvS13Oxv8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036