UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rkb+UA41NW7AYuqdrP0WEkGarv7K+ftRg27SHCCVarE=' 
WHERE 
  key_id = 'a16dc5d602914c6085580c26c7acdea1f6f9edfd37a82205c4ddd07a05cdd958' 
  AND (
    token = 'rkb+UA41NW7AYuqdrP0WEkGarv7K+ftRg27SHCCVarE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031