UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G+UqOkfNsWt5yVlfHyvr2bMBVcEBtYPd0gq5T6ZCXAM=' 
WHERE 
  key_id = '2d85047395f92db4ccbf841e6c257af2bec249e2e3c73ad4442f23841d458439' 
  AND (
    token = 'G+UqOkfNsWt5yVlfHyvr2bMBVcEBtYPd0gq5T6ZCXAM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021