UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZnGYQ37ZAt/l9WCsxOkLaSVH+061PFv+krwgaI0Yj24=' 
WHERE 
  key_id = 'a76b3ff99f050526a7c1289d5a58fe0083e004406dc1c8a4ad29bf6df058dd16' 
  AND (
    token = 'ZnGYQ37ZAt/l9WCsxOkLaSVH+061PFv+krwgaI0Yj24=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052