UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VEIO8Zyrobe4/P+cabEHpGNE31qlRzBt8uqo9dkAZ+Y=' 
WHERE 
  key_id = '4335c31d59dedac0e57d340ab69cacc437088caf47d84982a0ef320d52bbfd15' 
  AND (
    token = 'VEIO8Zyrobe4/P+cabEHpGNE31qlRzBt8uqo9dkAZ+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056