UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I+jHMIheQ2d2lPQFEy6CnVvARJM6sL9E74MPELwGhpU=' 
WHERE 
  key_id = '90f5900ee784fabc4d6fbae8cfb49fdda67fe81ee526138138c784805618b076' 
  AND (
    token = 'I+jHMIheQ2d2lPQFEy6CnVvARJM6sL9E74MPELwGhpU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022