UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IqllSbP46xxWJmDverO35LXCC8aRKRl0zdqDjqLYKF8=' 
WHERE 
  key_id = '8af0b050a55e9ab711af8dc69b08ce048c03ad6b9afc5d6d9f33f1d4354f691b' 
  AND (
    token = 'IqllSbP46xxWJmDverO35LXCC8aRKRl0zdqDjqLYKF8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049