UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KqnvdoQhs3uphIFNQDgu5febX9VmO7je6/ENfPItHw8=' 
WHERE 
  key_id = '7d1a61a817bfcf2cfdfd828ca56b048adc2ed1ceae04acda42eb9e6a4b91a9a9' 
  AND (
    token = 'KqnvdoQhs3uphIFNQDgu5febX9VmO7je6/ENfPItHw8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028