UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cc8/BtC7gaSmSwy/sdav/VnGIV6wVrrxmzJiOH7tUOs=' 
WHERE 
  key_id = 'b66b57c42044fc781e7b41edbe4da49428df76540c156b6423b5c9f6adbd1786' 
  AND (
    token = 'Cc8/BtC7gaSmSwy/sdav/VnGIV6wVrrxmzJiOH7tUOs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023