UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DrZe72lB/1ETR/K/aF6ALSM+dztTUvYVTPI0d0BU3bE=' 
WHERE 
  key_id = 'c5701538ccf4e11e417aaaa293e25f618e4a3466809c9738fa49e6157438cb1b' 
  AND (
    token = 'DrZe72lB/1ETR/K/aF6ALSM+dztTUvYVTPI0d0BU3bE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057