UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aFsbe6lW6rmIe4szfNq5YPS7nAiBYzTNQV8YHk5GrAA=' 
WHERE 
  key_id = '5debfe722204698a355d195a352a7ab304d4b0cd05500e3054dc8e794b7a4c62' 
  AND (
    token = 'aFsbe6lW6rmIe4szfNq5YPS7nAiBYzTNQV8YHk5GrAA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054