UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JzVfNAVmSLK7QpdzJe5i7RsaOLfBdeMYbh4zVr+9wfU=' 
WHERE 
  key_id = '2fdd340adde9edb93f6d07489534ab039c122361583e0e9b7e36effd33a54242' 
  AND (
    token = 'JzVfNAVmSLK7QpdzJe5i7RsaOLfBdeMYbh4zVr+9wfU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032