UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'twWR0QhhLDZQPB1g5qs2LPvw+5/QwzBSj7XyHd7yPKg=' 
WHERE 
  key_id = '79c1aaf450cff135778ca0893dba62cd61cb85c60d402b3e96f1769155248772' 
  AND (
    token = 'twWR0QhhLDZQPB1g5qs2LPvw+5/QwzBSj7XyHd7yPKg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028