UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a/J3G97zjX+WCfDQmlQzfD1vi/ZTdK24fcUlD3az7+U=' 
WHERE 
  key_id = '5b496b1b8c6642422d67caf74cbecea2d2cee9f7e133ac5d986a9809178446a2' 
  AND (
    token = 'a/J3G97zjX+WCfDQmlQzfD1vi/ZTdK24fcUlD3az7+U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033