UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RwSOSfi+fYwHtEsycdk+CKvNh7X3eDfBWxMNvHsFotY=' 
WHERE 
  key_id = '54d879e5d726ba57ead9d2e9fda4ad4036960934b16cfe3f2f364057cb375319' 
  AND (
    token = 'RwSOSfi+fYwHtEsycdk+CKvNh7X3eDfBWxMNvHsFotY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018