UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'daSpOBZtnksqzA8bhv3qa9RRkmV0OllLLTz+9zJPhu8=' 
WHERE 
  key_id = '3d1825ffd84c6712a98559d5e0616996497d33d377e84513f16de7331f4de108' 
  AND (
    token = 'daSpOBZtnksqzA8bhv3qa9RRkmV0OllLLTz+9zJPhu8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046