UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ccskXW516DC3Lt255bF0naPIMWepBC7OVHnl/yBonyU=' 
WHERE 
  key_id = '748189c9c374f23912883fbadcd522851d57c6627a1f5d98430a85e072275412' 
  AND (
    token = 'ccskXW516DC3Lt255bF0naPIMWepBC7OVHnl/yBonyU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032