UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lpYO1IZHD4yoJgLHT9MwuxNvv4YpyozmjwsuotjS2YQ=' 
WHERE 
  key_id = 'e1d33ad59dec454d12cbdc29f2f542915339393899253edc7e1134259585e554' 
  AND (
    token = 'lpYO1IZHD4yoJgLHT9MwuxNvv4YpyozmjwsuotjS2YQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027