UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bH3XzVcuolIToZe07wyQvc0aLJEuo8Tv0u1uBrUu2tE=' 
WHERE 
  key_id = '33b3c23b2aa30c856e97c25a85627683d84621395aba5d46b53f02893d5a092b' 
  AND (
    token = 'bH3XzVcuolIToZe07wyQvc0aLJEuo8Tv0u1uBrUu2tE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031