UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jJMmCaCLfU4rDRXdd1JZZT+KeltcoED5HKxOWqFuCEk=' 
WHERE 
  key_id = '0773b5a37c5d2f2af38e2c673c3e05ed5c45c2a43972ce5371e1a86ed772476c' 
  AND (
    token = 'jJMmCaCLfU4rDRXdd1JZZT+KeltcoED5HKxOWqFuCEk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034