UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o4xCpIjXey+Rj43oq4Dzl7fXGuYe3R/dN+n43DdkN10=' 
WHERE 
  key_id = '74e16515f3f87d1be792a4b4cb38c7219b1d4eeb90942e900df494eb1451c120' 
  AND (
    token = 'o4xCpIjXey+Rj43oq4Dzl7fXGuYe3R/dN+n43DdkN10=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034