UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd+YXc4V/L8I9EH6UnSM6UQ44pgVpBYE9k454u0PPtYo=' 
WHERE 
  key_id = '4a578e42e4e16105de5a744a0b368b12d3a8c1dbfa4708f3e32bd15041f34f83' 
  AND (
    token = 'd+YXc4V/L8I9EH6UnSM6UQ44pgVpBYE9k454u0PPtYo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034