UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PCCSr293+kXniGvYsd1LbBVLdZqNaasCho338wZXweo=' 
WHERE 
  key_id = '37c5b78d17672641615f09447d9cd436d708664df0b3289a52642e50128e1098' 
  AND (
    token = 'PCCSr293+kXniGvYsd1LbBVLdZqNaasCho338wZXweo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036