UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zr7GmS5Eg4mA48m7yXFKz2y+TsuQX38DfqgP+/sKCGc=' 
WHERE 
  key_id = '228c39ac0c2d7aa94316a9c2e6316c8412ad1232bd0b2b978fe9e96383b594d1' 
  AND (
    token = 'zr7GmS5Eg4mA48m7yXFKz2y+TsuQX38DfqgP+/sKCGc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065