UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SZYkTxF3akdLbgPJFSCUTInOjvWJ4Fv4gOVDJ1F/YRI=' 
WHERE 
  key_id = 'a323a04107a15bf463e00913809c5c0614437b8e00bb83ac5099952aa9b1787d' 
  AND (
    token = 'SZYkTxF3akdLbgPJFSCUTInOjvWJ4Fv4gOVDJ1F/YRI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00011