UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WALBeaGFwVPC4u7zbO6TKmUM7XwzYaXpKehU1gK1ggw=' 
WHERE 
  key_id = '185370e215097e57134d4985724f100515567b67cf15d93a986cb615df7e3ab3' 
  AND (
    token = 'WALBeaGFwVPC4u7zbO6TKmUM7XwzYaXpKehU1gK1ggw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025