UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lFcPXC8DB2d7CGzt9TMTtItmZlXkX4AUKO4dbEqVHJQ=' 
WHERE 
  key_id = '1684d0f861e0b22586894dba7a59e258642a224042a0ef9ff9e3f09504f92198' 
  AND (
    token = 'lFcPXC8DB2d7CGzt9TMTtItmZlXkX4AUKO4dbEqVHJQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018