UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h3OwwPm5lTcjQ2dx5hjE+IrbsbzoVDWLGWNGvj4ecT8=' 
WHERE 
  key_id = '4d686dbf0027466cf3e71b2eb5650ac1ec7ea567b02ca8216357fd0872aeabbf' 
  AND (
    token = 'h3OwwPm5lTcjQ2dx5hjE+IrbsbzoVDWLGWNGvj4ecT8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022