UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cXc5n8W3j9NxLDCqFslsbeMoQO1xPnku/rjyX3JJp4E=' 
WHERE 
  key_id = 'e745b08cd7d40089ae70d670132f5c5e4f43f1214c6cc92712101af137794804' 
  AND (
    token = 'cXc5n8W3j9NxLDCqFslsbeMoQO1xPnku/rjyX3JJp4E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035