UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HS6baL1i/rhmbsHCObE5xgKliE2i9iq9kXXvODgScDg=' 
WHERE 
  key_id = '80a9fa4b2c91ef25837ecbb7b1cc2266f7de2d0ceed0fcf2546fc4c44149ad75' 
  AND (
    token = 'HS6baL1i/rhmbsHCObE5xgKliE2i9iq9kXXvODgScDg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025