UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GB93aZOjOhhFbJu1eTYDhS5IcjcplKmexQ1xRmRkWDs=' 
WHERE 
  key_id = '9c904a54e16f905cb46a11c5628b5d8212e0b975ecdc8e0f1d19c42c9569d6b9' 
  AND (
    token = 'GB93aZOjOhhFbJu1eTYDhS5IcjcplKmexQ1xRmRkWDs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058