UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tUQt0i9wHExdTfIuSdiizV5HAPT3M8WZ+TSuktXByEw=' 
WHERE 
  key_id = '1c166c9b66ebb8996b2ddef4bc23ccfad84973314f6d5fcce5b12e6b7584a4f7' 
  AND (
    token = 'tUQt0i9wHExdTfIuSdiizV5HAPT3M8WZ+TSuktXByEw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027