UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yAQ5T267I8UNNMGsrcTejA6bLITlpg78Tpr949+nbY0=' 
WHERE 
  key_id = 'adae1d76fdf452b3005422a0f268bc3756fb826d85f39299a2166c802f509ff9' 
  AND (
    token = 'yAQ5T267I8UNNMGsrcTejA6bLITlpg78Tpr949+nbY0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035