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

Query time 0.00038