UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CVPOxvwr4oTxQ9qq03goewVMdCTZenrKXQCL6UcB+F4=' 
WHERE 
  key_id = '0f2e2bb2c18796c91fb6054b3c99830a53cc0547bc2e84edf2f903b8814fbfac' 
  AND (
    token = 'CVPOxvwr4oTxQ9qq03goewVMdCTZenrKXQCL6UcB+F4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047